<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Test02</title>
</head>
<body>
<script type="text/javascript">
    function Person(name, age) {
        this.name = name;
        this.age = age;
    }

    function Student(school) {
        this.school = school;
    }

    Student.prototype = new Person("zhangsan", 18);

    let stu01 = new Student("abc school");

    console.dir(stu01);

    console.log(stu01.name);
    console.log(stu01.age);
    console.log(stu01.school);

    console.log(stu01.__proto__.name);
    console.log(stu01.__proto__.age);
    console.log(stu01.__proto__.school);

    let stuProto = Object.getPrototypeOf(stu01);

    stuProto.addr = "xxx-yyy-zzz";

    console.dir(stuProto);

    Object.setPrototypeOf(stu01, stuProto);

    console.dir(stu01);

    console.dir(Object.getOwnPropertyDescriptor(stu01, "name"));
    console.dir(Object.getOwnPropertyDescriptor(stu01, "school"));

    // stu01.grade = 80;

    Object.defineProperty(stu01, "grade", {
        enumerable: false,
        value: 80
    });

    console.dir(stu01);

    console.dir(Object.getOwnPropertyDescriptor(stu01, "grade"));


</script>
</body>
</html>